package _17_剑指Offer;

import java.util.Stack;

public class _09_剑指Offer用两个栈实现队列 {

    private final Stack<Integer> outStack = new Stack<>();

    private final Stack<Integer> inStack = new Stack<>();

    public _09_剑指Offer用两个栈实现队列() {

    }

    public void appendTail(int value) {
        // 直接入进栈队列
        inStack.add(value);
    }

    public int deleteHead() {

        if (outStack.isEmpty()) {
            while (!inStack.isEmpty()) {
                outStack.push(inStack.pop());
            }
        }
        return outStack.isEmpty()? -1: outStack.pop();
    }

}
